@extends('admin')

@section('content')

    <div class="nav">
        <ul class="cc">
            <li class="current">
                <a href="{{url('admin/stores')}}">商家管理</a>
            </li>
            <li>
                <a href="{{url('admin/receipt')}}">收单数据</a>
            </li>
        </ul>
    </div>

    <p class="mb10">
        <a href="{{url('admin/stores/update')}}" class="btn J_dialog" title="新增商家"><span class="add"></span>新增商家</a>
    </p>

    <div class="h_a">搜索</div>
    <div class="search_type cc mb10">
        <form action="{{url('admin/stores')}}" method="get" class="search_form">
            <label for="search_name">账号：</label><input type="text" name="name" value="{{$name}}" id="search_name" class="input length_2 mr10"/>
            <label for="search_store">店铺：</label><input type="text" name="store" value="{{$store}}" id="search_store" class="input length_2"/>
            <button type="submit" class="btn">提交查询</button>
        </form>

    </div>

    <div class="table_list">
        <div id="data_list">
            <table class="items">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>账号</th>
                    <th>推荐码</th>
                    <th>店铺名称</th>
                    <th>所在城市</th>
                    <th>联系人</th>
                    <th>营业额</th>
                    <th>金币</th>
                    <th>代理</th>
                    <th>发展会员</th>
                    <th>审核认证</th>
                    <th>状态</th>
                    <th>注册时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach ($list as $item)
                    <tr>
                        <td>{{$item->id}}</td>
                        <td>{{$item->user->name}}</td>
                        <td>{{$item->user->code}}</td>
                        <td>{{$item->store_name}}</td>
                        <td>{{$item->city->name}}</td>
                        <td>{{$item->user->real_name}}</td>
                        <td><a title="{{$item->user->nick}}的账户记录" href="{{url('admin/users/accountlog/'.$item->user->id.'/cash')}}" class="J_dialog">{{$item->user->account->cash}}</a></td>
                        <td><a title="{{$item->user->nick}}的账户记录" href="{{url('admin/users/accountlog/'.$item->user->id.'/coin')}}" class="J_dialog">{{$item->user->account->coin}}</a></td>
                        <td>@if ($item->user->parent) {{$item->user->parent->name}} @else <span class="gray">无</span> @endif</td>
                        <td>@if (count($item->user->sub)) <a class="J_dialog" title="{{$item->user->name}}推荐的会员" href="{{url('admin/users/sub/'.$item->user->id)}}">{{count($item->user->sub)}} 人</a> @else
                                <span class="gray">0 人</span> @endif</td>
                        <td>@if ($item->user->auth_status) <a class="green J_dialog" title="店铺审核认证" href="{{url('admin/stores/auth/'.$item->user->id)}}">已认证</span> @else <a title="店铺审核认证" href="{{url('admin/stores/auth/'.$item->user->id)}}" class="red J_dialog">未认证</a> @endif</td>
                        <td>@if ($item->user->status) <span class="green">启用</span> @else <span class="red">禁用</span> @endif</td>
                        <td>{{$item->created_at}}</td>
                        <td>
                            <a href="{{url('admin/stores/update/'.$item->user->id)}}" title="{{$item->store_name}}资料" class="mr10 J_dialog">[编辑]</a>
                            <a href="{{url('admin/stores/sub/'.$item->user->id)}}" title="{{$item->store_name}}子账号" class="mr10 J_dialog">[子账号]</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
        </div>

        <div class="summary">
            共有 {{$list->total()}} 条数据
        </div>
        @if ($list->hasPages())
            <div class="pager">
                <!--
                <span style="float:left; margin-right:10px;">
                    转至<input type="text" id="goToPage" class="input" style="width:30px; text-align:center;">页
                    <span onclick="goto();" class="btn btn_submit">跳转</span>
                </span>
                -->
                {!! $list->appends($appends)->render() !!}
            </div>
        @endif
    </div>

@stop